home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------*\
- *
- * File Name: SETUP.RUL
- *
- * Description: InstallSHIELD HyperTerminal Setup script.
- *
- *
- *
- *
- * Author: Hilgraeve Inc. Date: 11-8-95
- *
- *
- *
- \*----------------------------------------------------------------------------*/
-
-
-
- // Size of components.
- #define SIZE_REQ_SAMPLES 82000
- #define SIZE_REQ_TEMPLATES 2000
- #define SIZE_REQ_PROGRAM 482903
-
- #define APP_NAME "HyperTerminal Private Edition"
- #define PROGRAM_GROUP_NAME "HyperTerminal"
- #define APPBASE_PATH "Accessories\\HyperTerminal\\"
- #define COMPANY_NAME "Microsoft"
- #define PRODUCT_NAME "HyperTerminal"
- #define PRODUCT_VERSION "CurrentVersion"
- #define PRODUCT_KEY "HYPERTRM.EXE"
- #define UNINSTALL_KEY "HyperTermPEV1"
- #define APPBASE_DIR95 "Program Files"
- #define BASE_REGISTRYNT "Software\\Microsoft\\Windows NT\\CurrentVersion\\App Paths\\"
- #define BASE_REGISTRY95 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"
-
- #define STR_COMPLETE95 "by selecting the program icon in the Programs menu.\n\n"
- #define STR_COMPLETENT "by selecting the program icon in the program group.\n\n"
-
- declare
-
- // Global variable declarations.
- STRING svGrp, szMsg, szFileSet, szTitle, szAppPath, szAppSharedDir;
- STRING szProgram, szTemp, svUninstLogFile, szRegKey, szfile;
- STRING svMainDirectory[ _MAX_STRING ];
- BOOL bSpaceOk, bReshowSetupType;
- NUMBER nResult, nStatusId, nType;
-
- BOOL bIncludeProgram, bIncludeSamples, bIncludeHelp;
- BOOL bWinNT;
-
- // Function declarations.
- prototype SetupScreen();
- prototype CheckRequirements();
- prototype CheckSpaceRequirements( number, number, number, string );
- prototype CreateRegDBEntries();
-
- program
-
- StartHere:
- Disable( BACKGROUND );
-
- // Set up the installation screen.
- SetupScreen();
-
- // Set installation info., which is required for registry entries.
- InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
-
- // Create a Welcome dialog.
- WelcomeDlg:
- Disable( BACKBUTTON );
- Welcome( "Welcome", 0 );
- Enable( BACKBUTTON );
-
- // Test target system proper configuration.
- CheckRequirements();
-
- // Ask user for a destination location for the installation.
- GetTargetDirectory:
-
- svMainDirectory = TARGETDISK ^ APPBASE_DIR95 ^ APPBASE_PATH;
-
- szMsg = "NOTE: Choosing to install in the default directory location will overwrite existing HyperTerminal program files. ";
- szMsg = szMsg + "If you wish to keep your existing program files, select";
- szMsg = szMsg + " a different destination location.";
-
- if ( AskDestPath( "Choose Destination Location", szMsg,
- svMainDirectory, 0 ) = BACK ) then
- goto WelcomeDlg;
- endif;
-
- szAppSharedDir = svMainDirectory;
-
- nType = TYPICAL;
-
- DetermineUserSelection:
-
- bIncludeSamples = TRUE;
- bIncludeProgram = TRUE;
- bIncludeHelp = TRUE;
-
- szMsg = "Select the options you want installed.\n" +
- "NOTE: Selecting to install pre-defined Connections may " +
- "overwrite your previous connection files with the same file name.";
-
- // Call AskOptions function to display the dialog box.
- if ( AskOptions( NONEXCLUSIVE, szMsg,
- "&Application Program Files", bIncludeProgram,
- "&Pre-defined Connections", bIncludeSamples,
- "On Line &Help Files", bIncludeHelp) = BACK ) then
- goto GetTargetDirectory;
- endif;
-
- // Check to see if target system meets space requirements.
- bSpaceOk = CheckSpaceRequirements( bIncludeSamples,
- bIncludeProgram,
- bIncludeHelp,
- svMainDirectory );
-
- // Ask user to try again if not enough space available.
- if (bSpaceOk = FALSE) then goto DetermineUserSelection; endif;
-
- FolderSelection:
- //if ( bWinNT ) then
- // svGrp = PROGRAM_GROUP_NAME;
-
- // Allow user to modify folder name.
- // if ( SelectFolder( "Folder Selection", svGrp, svGrp ) = BACK ) then
- // goto DetermineUserSelection;
- // endif;
- //endif;
-
-
-
- FileTransferSetup:
-
- // Prepare InstallSHIELD to record deinstallation information.
- DeinstallStart( svMainDirectory, svUninstLogFile, UNINSTALL_KEY, 0 );
- RegDBSetItem( REGDB_UNINSTALL_NAME, APP_NAME );
-
- // Set registry App Paths key information for the main application.
- szAppPath = svMainDirectory + ";" + szAppSharedDir;
- RegDBSetItem( REGDB_APPPATH, szAppPath );
- szProgram = svMainDirectory ^ "hypertrm.exe";
- RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
-
- // Define the "General" file set.
- szFileSet = "General";
- TARGETDIR = svMainDirectory;
-
- FileSetBeginDefine( szFileSet );
-
- SetStatusWindow( -1, "Copying readme file..." );
-
- // Always copy README & related files, located at
- // the root level in the DATA.Z library file.
- CompressGet( "ht.z", "readme.txt", COMP_NORMAL );
-
- //Delay(1);
-
- SetStatusWindow( 25, "Copying connection files..." );
-
- if (bIncludeSamples) then
- TARGETDIR = svMainDirectory;
- CompressGet( "ht.z", "*.ht", COMP_NORMAL);
- endif;
-
- //Delay(1);
-
- SetStatusWindow( 50, "Copying program files..." );
-
- if (bIncludeProgram) then
- TARGETDIR = szAppSharedDir;
- CompressGet( "ht.z", "*.dll", SHAREDFILE | COMP_UPDATE_DATE );
- CompressGet( "ht.z", "*.exe", SHAREDFILE | COMP_UPDATE_DATE );
- endif;
-
- //Delay(1);
-
- SetStatusWindow( 90, "Copying help..." );
-
- if (bIncludeHelp) then
- TARGETDIR = svMainDirectory;
- CompressGet( "ht.z", "*.hlp", COMP_NORMAL);
- endif;
-
- //Delay(1);
-
-
- FileSetEndDefine( szFileSet );
-
- DoFileTransfer:
- // Set up progress indicator and information gauge.
- Enable( STATUSDLG );
- StatusUpdate( ON, 90 );
-
- // Perform the file set.
- nResult = FileSetPerformEz( szFileSet, 0 );
-
- switch (nResult)
-
- case FS_DONE: // Successful completion.
-
- case FS_CREATEDIR: // Create directory error.
- MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
- "Please check write access to this directory.", SEVERE );
- abort;
-
- default: // Group all other errors under default label.
- NumToStr( szTemp, nResult );
- MessageBox( "General file transfer error."+
- "Please check your target location and try again."+
- "\n\n Error Number:"+szTemp, SEVERE );
-
- abort;
- endswitch;
-
- szfile = svMainDirectory ^ "*.dll";
- SetFileInfo( szfile , FILE_ATTRIBUTE, FILE_ATTR_HIDDEN , "" );
- TARGETDIR = svMainDirectory;
- DeleteFile( "DeIsLog.*" );
-
-
- SetRegistryEntries:
-
- CreateRegDBEntries( );
-
- Delay(2);
- Disable( FEEDBACK_FULL );
- Disable( STATUSDLG );
-
- // Create program groups (folders) and icons.
-
- CreateFolderIcons:
- SetStatusWindow( 95, "Creating Folder and Icons...." );
-
- LongPathToShortPath( svMainDirectory );
-
-
-
- // Create shortcut to HyperTerminal directory
- AddFolderIcon( "Accessories" , "HyperTerminal" ,
- svMainDirectory ,
- "" , "" , 0 , "" ,
- REPLACE );
-
- // Announce setup complete and offer to read README file.
- SetStatusWindow( 100, "Installation complete." );
-
- // If shared files could not be installed, then users must restart system.
- if (BATCH_INSTALL = TRUE) then
- szMsg = "Some files could not be installed because they are "+
- "currently in use by other programs in the system. "+
- "To allow for proper operation of the new program you should restart "+
- "your system at this time.";
- CommitSharedFiles(0);
- RebootDialog( "Restart Windows", szMsg, SYS_BOOTMACHINE );
- else
- ShowProgramFolder(svMainDirectory, SW_RESTORE);
- szMsg = "Setup is complete. You may run the installed program ";
- if ( bWinNT ) then
- szMsg = szMsg + STR_COMPLETENT;
- else
- szMsg = szMsg + STR_COMPLETE95;
- endif;
-
- MessageBeep( 0 );
- MessageBox( szMsg, INFORMATION );
- endif;
-
- exit;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: SetupScreen
- *
- * Purpose: This function will set up the screen look. This includes
- * colors, fonts, text to be displayed, etc.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function SetupScreen()
- begin
-
- Enable( INDVFILESTATUS );
-
- SetTitle( APP_NAME + " Setup", 28, WHITE );
-
- SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
-
- Enable( BACKGROUND );
-
- end;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CheckRequirements
- *
- * Purpose: This function will check all minimum requirements for the
- * application being installed. If any fail, then the user
- * is informed and the installation is terminated.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function CheckRequirements()
- number nvDx, nvDy;
- number nvResult;
- STRING szResult;
- begin
-
- // Determine if target system uses NT or Windows 95.
- GetSystemInfo( WINMAJOR, nvResult, szResult );
- bWinNT = TRUE;
- if (nvResult = 4) then
- bWinNT = FALSE; // Running Windows 95.
- endif;
-
- // Check screen resolution.
- GetExtents( nvDx, nvDy );
- if (nvDy < 480) then
- MessageBox( "This program requires VGA or better resolution.", WARNING );
- exit;
- endif;
-
- end;
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CheckSpaceRequirements
- *
- * Purpose: This function will check space requirements based on the
- * elements being installed.
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function CheckSpaceRequirements( bIncludeSamples,
- bIncludeProgram,
- bIncludeHelp,
- szDir )
- number nSizeRequired;
- begin
-
- nSizeRequired = 0;
-
- // Determine total size.
- if (bIncludeSamples) then
- nSizeRequired = nSizeRequired + SIZE_REQ_SAMPLES;
- endif;
-
- if (bIncludeHelp) then
- nSizeRequired = nSizeRequired + SIZE_REQ_TEMPLATES;
- endif;
-
- if (bIncludeProgram) then
- nSizeRequired = nSizeRequired + SIZE_REQ_PROGRAM;
- endif;
-
- // Check space on target drive.
- bSpaceOk = TRUE;
- if (GetDiskSpace( szDir ) < nSizeRequired) then
- szMsg = "There is not enough space available on the disk\n" +
- "'" + svMainDirectory + "' \n" +
- "Please free up some space or change the target location\n" +
- "to a different disk";
- MessageBeep(0);
- MessageBox( szMsg, WARNING );
- bSpaceOk = FALSE;
- endif;
-
- return bSpaceOk;
- end;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CreateRegDBEntries
- *
- * Purpose: This function will create necessary keys and values for
- * the sample program.
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function CreateRegDBEntries()
- string szKey[255], szClass[255], szValue, szDemo, szProgram;
-
- begin
-
- // Set root registry level
- RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
-
- // Create App Path entry
- szKey = BASE_REGISTRY95 + "\\" + PRODUCT_KEY;
- szClass = svMainDirectory ^ PRODUCT_KEY;
- RegDBCreateKeyEx( szKey, szClass );
- RegDBSetKeyValueEx( szKey, "Path", REGDB_STRING, svMainDirectory, -1 );
-
- // Create .ht class.
- szKey = "\\SOFTWARE\\Classes\\.ht";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "htfile", -1 );
-
- // Create htfile class.
- szKey = "\\SOFTWARE\\Classes\\htfile";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "HyperTerminal File", -1 );
-
- // Create htfile\defaulticon class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\DefaultIcon";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "%1", -1 );
-
- // Create htfile\defaulticon\shell class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shell";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "connect", -1 );
-
- // Create htfile\defaulticon\shell\connect class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shell\\connect";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "&Connect", -1 );
-
- // Create htfile\defaulticon\shell\connect\command class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shell\\connect\\command";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, svMainDirectory ^ "hypertrm.exe /d %1", -1 );
-
- // Create htfile\defaulticon\shell\open class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shell\\open";
- RegDBCreateKeyEx( szKey, "" );
-
- // Create htfile\defaulticon\shell\open\command class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shell\\open\\command";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, svMainDirectory ^ "hypertrm.exe %1", -1 );
-
- // Create htfile\shellex class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shellex";
- RegDBCreateKeyEx( szKey, "" );
-
- // Create htfile\shellex\IconHandler class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shellex\\IconHandler";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "{88895560-9AA2-1069-930E-00AA0030EBC8}", -1 );
-
- // Create htfile\shellex\PropertySheetHandlers class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shellex\PropertySheetHandlers";
- RegDBCreateKeyEx( szKey, "" );
-
- // Create htfile\shellex\PropertySheetHandlers\TermPage class.
- szKey = "\\SOFTWARE\\Classes\\htfile\\shellex\\PropertySheetHandlers\\TermPage";
- RegDBCreateKeyEx( szKey, "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "{1B53F360-9A1B-1069-930C-00AA0030EBC8}", -1 );
-
- // Create CLSID\... classes.
-
- // for Page handler
- szKey = "\\SOFTWARE\\Classes\\CLSID";
- szKey = szKey + "\\{1B53F360-9A1B-1069-930C-00AA0030EBC8}";
- RegDBCreateKeyEx( szKey , "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "HyperTerminal Connection Page Ext", -1 );
-
- szKey = szKey + "\\InProcServer32";
- RegDBCreateKeyEx( szKey , "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, svMainDirectory ^ "hypertrm.dll", -1 );
- RegDBSetKeyValueEx( szKey, "ThreadingModel", REGDB_STRING, "Apartment", -1 );
-
- // for Icon Handler
- szKey = "\\SOFTWARE\\Classes\\CLSID";
- szKey = szKey + "\\{88895560-9AA2-1069-930E-00AA0030EBC8}";
- RegDBCreateKeyEx( szKey , "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, "HyperTerminal Icon Ext", -1 );
-
- szKey = szKey + "\\InProcServer32";
- RegDBCreateKeyEx( szKey , "" );
- RegDBSetKeyValueEx( szKey, "", REGDB_STRING, svMainDirectory ^ "hticons.dll", -1 );
- RegDBSetKeyValueEx( szKey, "ThreadingModel", REGDB_STRING, "Apartment", -1 );
-
- end;
-
-